WEBVTT

00:01.300 --> 00:06.900
And this in the next video we will create forward looking portfolios with many constituents.

00:06.900 --> 00:13.120
So our six stocks and you will see in this and the next video that this is not that easy.

00:13.140 --> 00:14.880
So we are still important.

00:15.150 --> 00:23.160
The returns data frame with the daily returns of our six stocks and also the market the portfolio.

00:23.190 --> 00:31.430
And still we have imported the covariance matrix and uh here we are only interested in the covariance

00:31.430 --> 00:33.770
us of the six stocks.

00:33.890 --> 00:44.820
So we exclude here the market portfolio and we only select the covariance as of our six constituents.

00:45.020 --> 00:52.730
And also we have still imported the summary data frame with uh the annualized risk return systematic

00:52.730 --> 00:57.230
risk and better effect of our six constituents and the market portfolio.

00:57.320 --> 01:01.890
And also here we drop the market portfolio and the safe.

01:01.940 --> 01:07.040
The summary data frame with the constituents and the Arab summary constituents

01:09.990 --> 01:12.850
and also the many assets of many constituents.

01:12.960 --> 01:20.460
First of all we have to make predictions for the returns of the single assets and then calculate the

01:20.460 --> 01:27.960
expected return of the random portfolios and we create another column for our summary constituents data

01:27.960 --> 01:32.670
frame expected return 1 and the reset.

01:32.750 --> 01:38.820
The expected return of the Amazon stock to 25 percent then for Boeing 15 percent.

01:38.850 --> 01:40.420
Disney 8 percent.

01:40.650 --> 01:42.120
IBM 8 percent.

01:42.180 --> 01:46.710
Coca-Cola 10 and Microsoft 15 percent.

01:46.710 --> 01:53.690
So that's our expected return here and again we have uh six assets.

01:53.690 --> 01:56.210
So our six constituents.

01:56.210 --> 02:00.890
And in this video we want to create 1 million random portfolios

02:04.420 --> 02:08.380
and therefore first of all we said that the random C to a 1 2 3.

02:08.500 --> 02:18.490
And we create a matrix uh with 1 million times 6 random numbers between 0 and 1 and we reshape them

02:18.490 --> 02:21.950
into 1 million rows and 6 columns.

02:22.000 --> 02:24.310
So that's the matrix here.

02:24.700 --> 02:29.250
And then we normalize the elements in the matrix and create the weights.

02:29.260 --> 02:36.900
So this is actually nothing new so that's uh the weights of one million random portfolios.

02:36.900 --> 02:44.310
And then we can calculate the expected return of these 1 million random portfolios by having here our

02:44.310 --> 02:52.680
expected return 1 column and we apply the top method and pass the transpose the weights matrix here

02:55.900 --> 03:02.560
and here we get an umpire rate with 1 million elements and each element is actually a expected return

03:02.560 --> 03:09.370
of one random portfolio and the the same we can do for the risk so we can calculate the expected risk

03:09.370 --> 03:11.740
of our 1 million random portfolios.

03:12.250 --> 03:18.580
So we take the square root to calculate the standard deviation and then we use the dot method on the

03:18.580 --> 03:27.460
covariance matrix and pass the transpose the weights matrix then we transpose the result and multiply

03:27.460 --> 03:36.130
it again with the weights matrix and then we take the sum over all rows so let's have a look here.

03:38.320 --> 03:46.090
And we should actually get for one million random portfolios of 1000000 times the expected risk in terms

03:46.090 --> 03:48.000
of standard deviations.

03:48.010 --> 03:51.850
So here we have a number higher array also with the 1000000 elements.

03:51.940 --> 03:58.090
So we have in the risk an umpire race 1 million elements and in the returns an umpire Ray 1 million

03:58.090 --> 04:01.510
elements and now the next step.

04:01.520 --> 04:06.470
We also want to calculate the expected chop ratio of our 1 million portfolios.

04:06.740 --> 04:11.210
And therefore we need an approximation for the risk free return.

04:11.690 --> 04:15.430
And let's simply use here 2 percent.

04:15.820 --> 04:19.780
And then we can also calculate the SAP ratio.

04:19.780 --> 04:27.760
So we have the returns of our portfolios minus the risk free rate divided by the risk and finally we

04:27.760 --> 04:34.860
can create a summary data frame with the three columns so we have the returns of our 1 million portfolios.

04:34.870 --> 04:44.610
Then the expected risk and the expected chop ratio so that's the summary data frame with the one million

04:44.610 --> 04:54.000
portfolios and then we can also visualize our 1 million portfolios with the risk on the x axis and the

04:54.000 --> 04:55.680
return on the y axis

05:01.900 --> 05:04.840
so that's our cloud of portfolios.

05:04.870 --> 05:07.390
And this looks pretty amazing.

05:07.390 --> 05:14.980
So here we have the efficient frontier and now we can also search for the maximum Sharpe Ratio portfolio.

05:14.980 --> 05:24.030
So first before we use the described method on our summary data frame and we can see here that uh the

05:24.030 --> 05:32.460
max Sharpe Ratio portfolio has a sharp ratio of 0 point 8 8 3 4 and then with the idea smacks method

05:32.490 --> 05:40.050
we can also get uh the index label of the max operator or portfolio and this is the portfolio with the

05:40.050 --> 05:46.140
index label eight hundred seventy three thousand nine hundred fifteen and we can also filter for that

05:46.140 --> 05:47.080
portfolio.

05:47.100 --> 05:56.040
So let's have a look here and we have a return of sixteen point one three percent and a risk of 16 percent.

05:56.250 --> 06:02.820
And then finally we can also get to the rates of the max sharp racial portfolio bypassing the index

06:02.820 --> 06:11.930
label to the weights matrix and to have it more explicit we can also create a panel series with the

06:11.930 --> 06:17.330
index labels s index and the rates here as the column.

06:17.330 --> 06:25.160
So let's have a look here and here our max Sharpe Ratio portfolio we have 34 percent Amazon then 17

06:25.160 --> 06:34.190
percent Boeing almost 0 percent Disney and IBM and also Microsoft and the 45 percent Coca-Cola.

06:34.190 --> 06:41.090
And here we can see one pitfall of creating forward looking portfolios and optimizing them for the best

06:41.090 --> 06:41.930
portfolio.

06:42.230 --> 06:49.880
So this leads typically to concentrated positions and this portfolio is clearly not a perfectly diversified

06:49.880 --> 06:51.510
portfolio.

06:51.530 --> 06:56.470
That's one pitfall and in the next video we will discover some more problems and pitfalls.

06:56.470 --> 06:57.890
So I hope to see you there by.
